package com.cn.study008;

import java.util.Scanner;

/**
 * @author lw
 * @ClassName Test8005.java
 * @Description
 * @createTime 2023年05月14日 18:03:00
 */
public class Test8005 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int[] score=new int[]{99,85,82,63,60,0};
        System.out.println("请输入新增成绩：");
        int scr=sc.nextInt();
        int n=0;
        for (int i = 0; i < score.length; i++) {
            if (scr>score[i]){
                n=i;
                break;
            }
        }
        System.out.print("插入成绩的下标是："+n);

        for (int i = score.length-1; i>n; i--) {
            score[i]=score[i-1];
        }
        score[n]=scr;
        System.out.println("\n插入后的成绩信息是：");
        for (int i = 0; i < score.length; i++) {
            System.out.print(score[i]+" ");
        }

    }
}
